package com.cby.operation.login

import android.app.Activity
import com.cby.operation.anti.AntiAddictManager
import com.cby.operation.initialize.InitListener
import com.cby.operation.initialize.InitManager

object OperationSDK {

    /**
     * SDK初始化接口
     * @param activity
     * @param gameId
     */
    fun initSdk(
        activity: Activity?,
        gameId: String,
        orientation: Int,
        listener: InitListener?
    ) {
        InitManager.instance.initConfig(activity, gameId, orientation, listener)
    }

    /**
     * 登录接口
     *
     * @param activity
     * @param switchUser
     * @param listener
     */
    fun login(activity: Activity, switchUser: Boolean, listener: LoginListener) {
        LoginManager.instance.doLogin(activity, switchUser, listener)
    }

    /**
     * 退出登录接口
     */
    fun logout(activity: Activity?) {
        LoginManager.instance.logout(activity)
    }

    /**
     * 用户信息获取接口
     * @return UserInfo
     */
    fun getUser() : UserInfo? = LoginManager.instance.getUserInfo()

    /**
     * 释放sdk资源
     */
    fun releaseSDK() {
        LoginManager.instance.reset()
        AntiAddictManager.instance.stopAnti()
    }
}